package com.gxa.web.controller;

import com.alibaba.fastjson.JSONObject;
import com.gxa.common.R;
import com.gxa.pojo.Basicinfo;
import com.gxa.service.ParamService;
import com.gxa.service.impl.ParamServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@WebServlet("/edit/basic")
public class EditBasicInfoServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        int id = Integer.parseInt(req.getParameter("id"));
        String describes = req.getParameter("describes");
        String keywords = req.getParameter("keywords");
        String parameter = req.getParameter("parameter");

        Basicinfo basicinfo = new Basicinfo();
        basicinfo.setId(id);
        basicinfo.setDescribes(describes);
        basicinfo.setKeywords(keywords);
        basicinfo.setParameter(parameter);

        ParamService paramService = new ParamServiceImpl();
        R r = paramService.updateUser(basicinfo);
        resp.setContentType("application/json;charset=utf-8");
        resp.getWriter().write(JSONObject.toJSONString(r));
    }
}
